#include <unordered_map>
#include <string>
#include <iostream>
#include <vector>

using namespace std;

vector<string> str;

bool check(string& x, string& y)
{
    unordered_map<char, int> map;
    for (auto ch : x)map[ch] = 1;
    for (auto ch : y)
    {
        if (map[ch] == 1) return true;
    }
    return false;
}

int main()
{
    int t;
    cin >> t;
    while (t--)
    {
        str.clear();
        int n;
        cin >> n;
        for (int i = 0; i < n; i++)
        {
            string tmp;
            cin >> tmp;
            str.push_back(tmp);
        }
        bool legal = true;
        for (int i = 0; i < n / 2; i++)
        {
            if (check(str[i], str[n - 1 - i]) == false)
            {
                legal = false;
                break;
            }
        }
        if (legal == true)cout << "Yes" << endl;
        else cout << "No" << endl;
    }

    return 0;
}